package com.example.administrator.qq;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.os.Bundle;
import android.view.View;

/**
 * Created by ykbboom on 2016/12/30.
 */
public class RankActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rank);
        TimeModelFragment fragment1 = new TimeModelFragment();
        addFragment(fragment1, "timefragment");
        StepModelFragment fragment2 = new StepModelFragment();
        addFragment(fragment2,"stepfragment");



//        ImageButton prebtn = (ImageButton) findViewById(R.id.pre);
//        ImageButton nextbtn = (ImageButton) findViewById(R.id.next);
//        prebtn.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//
////                    StepModelFragment fragment1 = new StepModelFragment();
////                    addFragment(fragment1, "stepfragment");
//                TextView textView = (TextView) findViewById(R.id.timetitle);
//                textView.setText("限步模式");
//
//
//            }
//        });
    }
    //添加fragment到Activity中
    private void addFragment(Fragment fragment, String tag) {
        FragmentManager manager = getSupportFragmentManager();
        FragmentTransaction transaction = manager.beginTransaction();
        transaction.add(R.id.fragment_container, fragment, tag);
        transaction.commit();
    }


}
